package com.ewei.web.common.utils;

import java.util.Locale;

/**
 * 管理列表对象的ThreadLocal数据
 * @author David
 *
 */
public class SystemContext {
	private SystemContext(){
	}
	/**
	 * 访问机的locale
	 */
	private static ThreadLocal<Locale> locale = new ThreadLocal<Locale>();
	/**
	 * 分页大小
	 */
	private static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>();
	/**
	 * 分页的起始页
	 */
	private static ThreadLocal<Integer> pageOffset = new ThreadLocal<Integer>();
	/**
	 * 列表的排序字段
	 */
	private static ThreadLocal<String> sort = new ThreadLocal<String>();
	/**
	 * 列表的排序方式
	 */
	private static ThreadLocal<String> order = new ThreadLocal<String>();
	private static ThreadLocal<String> realPath = new ThreadLocal<String>();
	public static String getRealPath(){
		return realPath.get();
	}
	public static void setRealPath(String _realPath){
		realPath.set(_realPath);
	}
	public static Integer getPageSize(){
		return pageSize.get();
	}
	public static void setPageSize(Integer _pageSize){
		pageSize.set(_pageSize);
	}
	public static Integer getPageOffset(){
		return pageOffset.get();
	}
	public static void setPageOffset(Integer _pageOffset){
		pageOffset.set(_pageOffset);
	}
	public static String getSort(){
		return sort.get();
	}
	public static void setSort(String _sort){
		sort.set(_sort);
	}
	public static String getOrder(){
		return order.get();
	}
	public static void setOrder(String _order){
		order.set(_order);
	}
	public static Locale getLocale(){
		return locale.get();
	}
	public static void setLocale(Locale _locale){
		locale.set(_locale);
	}
	public static void removeLocale(){
		locale.remove();
	}
	public static void removePageSize() {
		pageSize.remove();
	}
	public static void removePageOffset() {
		pageOffset.remove();
	}
	
	public static void removeSort() {
		sort.remove();
	}
	
	public static void removeOrder() {
		order.remove();
	}
	
	public static void removeRealPath() {
		realPath.remove();
	}
}
